package com.application.moneycalculator.activity;

import com.application.moneycalculator.R;
import com.application.moneycalculator.data.DBParser;
import com.application.moneycalculator.log.Log_;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;

public class AllExpensesActivity extends ListExpensesActivity{
	
	private final String TAG = "ListExpensesActivity";
	
    /** Called when the activity is first created. */
	private Button addExpenseButton;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	Log_.out(TAG, "onCreate start");
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listexpenses);
        
        addExpenseButton = (Button) findViewById(R.id.add_expense_button);
        addExpenseButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Log_.out(TAG, "try to show next Activity");
    			Intent intent = new Intent(AllExpensesActivity.this, ExpenseActivity.class);
    			intent.setAction(Intent.ACTION_INSERT);
    			startActivity(intent);
			}
		});
        
        if( !DBParser.getInstance().isDBLoaded() )
        {
        	DBParser.getInstance().parse(this);
        }
        
        Log_.out(TAG, "onCreate finish");
    }

	@Override
	protected void createListObject() {
		listExpenses = (ListView) findViewById(R.id.list_expenses);
	}

	@Override
	protected void createProgressBar() {
		//mProgress = (ProgressBar) findViewById(R.id.progressBar1);
		//mProgress.setVisibility(View.VISIBLE);

	}
}